﻿/*
	Copyright (c) 2017 TOSHIBA Digital Solutions Corporation

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Affero General Public License as
	published by the Free Software Foundation, either version 3 of the
	License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Affero General Public License for more details.

	You should have received a copy of the GNU Affero General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/*!
	@file
	@brief Definition of Exception and Error/Trace Code
*/
#ifndef GS_ERROR_H_
#define GS_ERROR_H_

#include "util/type.h"
#include "util/container.h"
#include "util/trace.h"


#define UNUSED_VARIABLE(b) (void)(b)

/*!
	@brief Handles Exception by exception type
*/
class GSExceptionRegenerator {
public:
	typedef util::Exception::NamedErrorCode NamedErrorCode;

	explicit GSExceptionRegenerator(
			UTIL_EXCEPTION_CONSTRUCTOR_ARGS_DECL) throw();

	void generate(util::Exception &dest, const char8_t *typeName) const throw();
	template <typename T>
	T generate(const char8_t *typeName) const throw();

	NamedErrorCode getNamedErrorCode() const throw();

	void formatField(std::ostream &stream,
		util::Exception::FieldType fieldType) const throw();

	bool getCause(util::Exception &dest) const throw();

	bool isCritical() const throw() {
		return critical_;
	}

private:
	GSExceptionRegenerator(const GSExceptionRegenerator &);
	GSExceptionRegenerator &operator=(const GSExceptionRegenerator &);

	static const NamedErrorCode &selectErrorCode(
		const NamedErrorCode &primary, const NamedErrorCode &secondary) throw();

	util::Exception base_;
	const char8_t *fileNameLiteral_;
	const char8_t *functionNameLiteral_;
	bool critical_;
};

template <typename T>
T GSExceptionRegenerator::generate(const char8_t *typeName) const throw() {
	T exception(
		0, NULL, NULL, NULL, 0, NULL, NULL, util::Exception::STACK_TRACE_NONE);
	generate(exception, typeName);

	return exception;
}

/*!
	@brief Formatter for writing message to event log file
*/
class GSTraceFormatter : public util::TraceFormatter {
public:
	explicit GSTraceFormatter(const char8_t *secretHexKey);
	virtual ~GSTraceFormatter();

	void setSecret(bool secret);
	void setTraceLocationVisible(bool visible);


	virtual void format(std::ostream &stream, util::TraceRecord &record);

protected:
	typedef util::TraceFormatter Base;

	virtual void formatFiltered(
		std::ostream &stream, const util::TraceRecord &record);

private:
	u8string obfuscate(const u8string &src);

	util::NormalXArray<uint8_t> secretKey_;
	bool secret_;
	bool traceLocationVisible_;
};

/*!
	@brief Handles system error
*/
class SystemException : public util::Exception {
public:
	explicit SystemException(UTIL_EXCEPTION_CONSTRUCTOR_ARGS_DECL) throw() :
			Exception(UTIL_EXCEPTION_CONSTRUCTOR_ARGS_SET) {
	}
	virtual ~SystemException() throw() {}

	template <typename T>
	static T raiseCustomOrSystem(
		const GSExceptionRegenerator &regenerator, const char8_t *typeName);
};

template <typename T>
inline T SystemException::raiseCustomOrSystem(
	const GSExceptionRegenerator &regenerator, const char8_t *typeName) {
	if (regenerator.isCritical()) {
		throw regenerator.generate<SystemException>("SystemException");
	}

	throw regenerator.generate<T>(typeName);
}

/*!
	@brief Handles user error
*/
class UserException : public util::Exception {
public:
	explicit UserException(UTIL_EXCEPTION_CONSTRUCTOR_ARGS_DECL) throw() :
			Exception(UTIL_EXCEPTION_CONSTRUCTOR_ARGS_SET) {}
	virtual ~UserException() throw() {}
};

class InterruptionChecker {
public:
	class CheckHandler;

	enum InterruptionType {
		INTERRUPTION_CANCEL,
		INTERRUPTION_SUSPEND,
		INTERRUPTION_HANDLER
	};

	InterruptionChecker();

	bool check();

	void setCheckHandler(CheckHandler *handler);
	void setInterruption(InterruptionType type);
	void clearInterruption();

	static bool checkFlags(int32_t flags);
	static void errorCanceled();

private:
	bool checkInternal();

	util::Atomic<int32_t> flags_;
	CheckHandler *handler_;
};

class InterruptionChecker::CheckHandler {
public:
	virtual ~CheckHandler();
	virtual bool operator()(InterruptionChecker &checker, int32_t flags) = 0;
};

inline bool InterruptionChecker::check() {
	return (flags_ != 0 && checkInternal());
}

#define UTIL_THROW_USER_ERROR(errorCode, message) \
	throw UTIL_EXCEPTION_CREATE_DETAIL(UserException, errorCode, NULL, message)
#define UTIL_THROW_SYSTEM_ERROR(errorCode, message) \
	throw UTIL_EXCEPTION_CREATE_DETAIL_TRACE(       \
		SystemException, errorCode, NULL, message)

#define UTIL_RETHROW_USER_ERROR(errorCode, cause, message) \
	throw UTIL_EXCEPTION_CREATE_DETAIL(                    \
		UserException, errorCode, &(cause), message)
#define UTIL_RETHROW_SYSTEM_ERROR(errorCode, cause, message) \
	throw UTIL_EXCEPTION_CREATE_DETAIL(                      \
		SystemException, errorCode, &(cause), message)

#define GS_ERROR_DEFAULT 0

#define GS_EXCEPTION_NAMED_CODE(codeSymbol) \
	util::Exception::makeNamedErrorCode(codeSymbol, #codeSymbol, "GS_ERROR_")
#define GS_EXCEPTION_CREATE_DETAIL(type, errorCode, cause, message) \
	UTIL_EXCEPTION_CREATE_DETAIL(                                   \
		type, GS_EXCEPTION_NAMED_CODE(errorCode), cause, message)
#define GS_EXCEPTION_CREATE_DETAIL_TRACE(type, errorCode, cause, message) \
	UTIL_EXCEPTION_CREATE_DETAIL_TRACE(                                   \
		type, GS_EXCEPTION_NAMED_CODE(errorCode), cause, message)

#define GS_EXCEPTION_CONVERT_CUSTOM(type, defaultCode, cause, message) \
	GS_EXCEPTION_CREATE_DETAIL(                                        \
		GSExceptionRegenerator, defaultCode, &(cause), message)        \
		.generate<type>(#type)
#define GS_EXCEPTION_CONVERT_CODED(defaultCode, cause, message) \
	GS_EXCEPTION_CONVERT_CUSTOM(util::Exception, defaultCode, cause, message)
#define GS_EXCEPTION_CONVERT(cause, message) \
	GS_EXCEPTION_CONVERT_CODED(GS_ERROR_DEFAULT, cause, message)

#define GS_EXCEPTION_CHECK_CRITICAL(cause)                      \
	GS_EXCEPTION_CREATE_DETAIL(                                 \
		GSExceptionRegenerator, GS_ERROR_DEFAULT, &(cause), "") \
		.isCritical()

#define GS_EXCEPTION_MESSAGE(cause) \
	GS_EXCEPTION_CONVERT(cause, "").getField(util::Exception::FIELD_MESSAGE)
#define GS_EXCEPTION_MESSAGE_ON(cause, message) \
	GS_EXCEPTION_MESSAGE(cause) << " on " << message
#define GS_EXCEPTION_MERGE_MESSAGE(cause, message) \
	message << " (reason=" << GS_EXCEPTION_MESSAGE(cause) << ")"

#define GS_THROW_CUSTOM_ERROR(type, errorCode, message) \
	throw GS_EXCEPTION_CREATE_DETAIL(type, errorCode, NULL, message)
#define GS_RETHROW_CUSTOM_ERROR(type, defaultCode, cause, message) \
	throw GS_EXCEPTION_CONVERT_CUSTOM(type, defaultCode, cause, message)
#define GS_RETHROW_CUSTOM_OR_SYSTEM(type, defaultCode, cause, message) \
	throw SystemException::raiseCustomOrSystem<type>(                  \
		UTIL_EXCEPTION_CREATE_DETAIL(GSExceptionRegenerator,           \
			GS_EXCEPTION_NAMED_CODE(defaultCode), &(cause), message),  \
		#type)

#define GS_THROW_USER_ERROR(errorCode, message) \
	GS_THROW_CUSTOM_ERROR(UserException, errorCode, message)
#define GS_THROW_SYSTEM_ERROR(errorCode, message) \
	GS_THROW_CUSTOM_ERROR(SystemException, errorCode, message)

#define GS_RETHROW_USER_ERROR_CODED(defaultCode, cause, message) \
	GS_RETHROW_CUSTOM_ERROR(UserException, defaultCode, cause, message)
#define GS_RETHROW_SYSTEM_ERROR_CODED(defaultCode, cause, message) \
	GS_RETHROW_CUSTOM_ERROR(SystemException, defaultCode, cause, message)
#define GS_RETHROW_USER_OR_SYSTEM_CODED(defaultCode, cause, message) \
	GS_RETHROW_CUSTOM_OR_SYSTEM(UserException, defaultCode, cause, message)

#define GS_RETHROW_USER_ERROR(cause, message) \
	GS_RETHROW_USER_ERROR_CODED(GS_ERROR_DEFAULT, cause, message)
#define GS_RETHROW_SYSTEM_ERROR(cause, message) \
	GS_RETHROW_SYSTEM_ERROR_CODED(GS_ERROR_DEFAULT, cause, message)
#define GS_RETHROW_USER_OR_SYSTEM(cause, message) \
	GS_RETHROW_USER_OR_SYSTEM_CODED(GS_ERROR_DEFAULT, cause, message)

#define GS_TRACE_NAMED_CODE(codeSymbol) \
	util::Exception::makeNamedErrorCode(codeSymbol, #codeSymbol, "GS_TRACE_")
#define GS_TRACER_PUT(tracer, level, code, message, cause) \
	UTIL_TRACER_PUT_CODED(                                 \
		tracer, level, GS_TRACE_NAMED_CODE(code), message, cause)
#define GS_TRACE_ERROR(tracer, code, message) \
	GS_TRACER_PUT(tracer, LEVEL_ERROR, code, message, NULL)
#define GS_TRACE_WARNING(tracer, code, message) \
	GS_TRACER_PUT(tracer, LEVEL_WARNING, code, message, NULL)
#define GS_TRACE_INFO(tracer, code, message) \
	GS_TRACER_PUT(tracer, LEVEL_INFO, code, message, NULL)
#define GS_TRACE_DEBUG(tracer, code, message) \
	GS_TRACER_PUT(tracer, LEVEL_DEBUG, code, message, NULL)

#define GS_FILE_WRITE_ALL(tracer, namedFile, data, size, offset, timeThreshold, retryCount) \
	{ \
		retryCount = 0; \
		off_t filePos = static_cast<off_t>(offset); \
		ssize_t writeRemain = size; \
		const uint8_t *writeAddr = static_cast<const uint8_t*>(data); \
		const uint64_t startClock = util::Stopwatch::currentClock(); \
		while (writeRemain > 0) { \
			ssize_t writtenSize = namedFile.write(writeAddr, writeRemain, filePos); \
			if (writtenSize == writeRemain) { \
				if (retryCount > 0) { \
					GS_TRACE_WARNING(tracer, GS_TRACE_CM_PARTIAL_IO, \
							"[Partial Write](LAST) fileName," << namedFile.getName() << \
							",offset," << filePos << \
							",requested," << writeRemain << \
							",result," << writtenSize); \
				} \
				break; \
			} \
			assert(writtenSize < writeRemain); \
			GS_TRACE_WARNING(tracer, GS_TRACE_CM_PARTIAL_IO, \
					"[Partial Write] fileName," << namedFile.getName() << \
					",offset," << filePos << \
					",requested," << writeRemain << \
					",result," << writtenSize); \
			writeRemain -= writtenSize; \
			writeAddr += writtenSize; \
			filePos += static_cast<off_t>(writtenSize); \
			++retryCount; \
		} \
		const uint32_t lap = util::Stopwatch::clockToMillis( \
				util::Stopwatch::currentClock() - startClock); \
		if (lap > timeThreshold) { \
			GS_TRACE_WARNING(tracer, GS_TRACE_CM_LONG_IO, \
					"[LONG I/O] write time," << lap << \
					",fileName," << namedFile.getName() << \
					",offset," << offset << \
					",time," << lap); \
		} \
	}

#define GS_FILE_READ_ALL(tracer, namedFile, data, size, offset, timeThreshold, retryCount) \
	{ \
		retryCount = 0; \
		off_t filePos = static_cast<off_t>(offset); \
		ssize_t readRemain = size; \
		uint8_t *readAddr = static_cast<uint8_t*>(data); \
		const uint64_t startClock = util::Stopwatch::currentClock(); \
		while (readRemain > 0) { \
			ssize_t readSize = namedFile.read(readAddr, readRemain, filePos); \
			if (readSize == readRemain) { \
				if (retryCount > 0) { \
					GS_TRACE_WARNING(tracer, GS_TRACE_CM_PARTIAL_IO, \
							"[Partial Read](LAST) fileName," << namedFile.getName() << \
							",offset," << filePos << \
							",requested," << readRemain << \
							",result," << readSize); \
				} \
				break; \
			} \
			if (readSize == 0 && retryCount > 0) { \
				util::FileStatus status; \
				namedFile.getStatus(&status); \
				if (status.getSize() <= filePos) { \
					memset(readAddr, 0, readRemain); \
					GS_TRACE_INFO(tracer, GS_TRACE_CM_PARTIAL_IO, \
							"[Partial Read (end of file)] fileName," << namedFile.getName() << \
							",offset," << offset << \
							",requested," << size << \
							",result," << (size - readRemain) << \
							",fileSize," << status.getSize()); \
					readRemain = 0; \
					break; \
				} \
			} \
			assert(readSize < readRemain); \
			GS_TRACE_WARNING(tracer, GS_TRACE_CM_PARTIAL_IO, \
					"[Partial Read] fileName," << namedFile.getName() << \
					",offset," << filePos << \
					",requested," << readRemain << \
					",result," << readSize); \
			readRemain -= readSize; \
			readAddr += readSize; \
			filePos += static_cast<off_t>(readSize); \
			++retryCount; \
		} \
		const uint32_t lap = util::Stopwatch::clockToMillis( \
				util::Stopwatch::currentClock() - startClock); \
		if (lap > timeThreshold) { \
			GS_TRACE_WARNING(tracer, GS_TRACE_CM_LONG_IO, \
					"[LONG I/O] read time," << lap << \
					",fileName," << namedFile.getName() << \
					",offset," << offset << \
					",time," << lap); \
		} \
	}

/*!
	@brief Error code
*/
enum ErrorCode {
	GS_ERROR_CM_FAILED = 1000,
	GS_ERROR_CM_NO_MEMORY,
	GS_ERROR_CM_SERVICE_UNKNOWN,
	GS_ERROR_CM_NAME_HAS_NO_OWNER,
	GS_ERROR_CM_NO_REPLY,
	GS_ERROR_CM_IO_ERROR,
	GS_ERROR_CM_BAD_ADDRESS,
	GS_ERROR_CM_NOT_SUPPORTED,
	GS_ERROR_CM_LIMITS_EXCEEDED,
	GS_ERROR_CM_ACCESS_DENIED,
	GS_ERROR_CM_AUTH_FAILED,
	GS_ERROR_CM_NO_SERVER,
	GS_ERROR_CM_TIMEOUT,
	GS_ERROR_CM_NO_NETWORK,
	GS_ERROR_CM_ADDRESS_IN_USE,
	GS_ERROR_CM_DISCONNECTED,
	GS_ERROR_CM_INVALID_ARGS,
	GS_ERROR_CM_FILE_NOT_FOUND,
	GS_ERROR_CM_FILE_EXISTS,
	GS_ERROR_CM_UNKNOWN_METHOD,
	GS_ERROR_CM_TIMED_OUT,
	GS_ERROR_CM_MATCH_RULE_NOT_FOUND,
	GS_ERROR_CM_MATCH_RULE_INVALID,
	GS_ERROR_CM_SPAWN_EXEC_FAILED,
	GS_ERROR_CM_SPAWN_FORK_FAILED,
	GS_ERROR_CM_SPAWN_CHILD_EXITED,
	GS_ERROR_CM_SPAWN_CHILD_SIGNALED,
	GS_ERROR_CM_SPAWN_FAILED,
	GS_ERROR_CM_SPAWN_SETUP_FAILED,
	GS_ERROR_CM_SPAWN_CONFIG_INVALID,
	GS_ERROR_CM_SPAWN_SERVICE_INVALID,
	GS_ERROR_CM_SPAWN_SERVICE_NOT_FOUND,
	GS_ERROR_CM_SPAWN_PERMISSIONS_INVALID,
	GS_ERROR_CM_SPAWN_FILE_INVALID,
	GS_ERROR_CM_SPAWN_NO_MEMORY,
	GS_ERROR_CM_UNIX_PROCESS_ID_UNKNOWN,
	GS_ERROR_CM_INVALID_SIGNATURE,
	GS_ERROR_CM_INVALID_FILE_CONTENT,
	GS_ERROR_CM_SELINUX_SECURITY_CONTEXT_UNKNOWN,
	GS_ERROR_CM_ADT_AUDIT_DATA_UNKNOWN,
	GS_ERROR_CM_OBJECT_PATH_IN_USE,
	GS_ERROR_CM_INTERNAL_ERROR,
	GS_ERROR_CM_PLATFORM_ERROR,
	GS_ERROR_CM_MEMORY_LIMIT_EXCEEDED,
	GS_ERROR_CM_SIZE_LIMIT_EXCEEDED,
	GS_ERROR_CM_CANCELED,
	GS_ERROR_CM_COMPRESSION_FAILED,
	GS_ERROR_CM_UNCOMPRESSION_FAILED,
	GS_ERROR_CM_INCOMPATIBLE_ZLIB_VERSION,

	GS_ERROR_TXN_SERVICE_START_FAILED = 10000,
	GS_ERROR_TXN_PARTITION_ALREADY_EXISTS,  
	GS_ERROR_TXN_PARTITION_CREATE_FAILED,
	GS_ERROR_TXN_PARTITION_NOT_FOUND,
	GS_ERROR_TXN_NODE_TYPE_INVALID,
	GS_ERROR_TXN_AUTH_FAILED,
	GS_ERROR_TXN_AUTH_REQUIRED,
	GS_ERROR_TXN_PARTITION_INACTIVE,  
	GS_ERROR_TXN_CLUSTER_ROLE_UNMATCH,
	GS_ERROR_TXN_PARTITION_ROLE_UNMATCH,
	GS_ERROR_TXN_PARTITION_STATE_UNMATCH,
	GS_ERROR_TXN_SESSION_REQUIRED,
	GS_ERROR_TXN_STATEMENT_TYPE_NOT_EXECUTABLE,
	GS_ERROR_TXN_STATEMENT_TYPE_UNKNOWN,
	GS_ERROR_TXN_STATEMENT_TIMEOUT,
	GS_ERROR_TXN_TRANSACTION_NOT_BEGIN,
	GS_ERROR_TXN_CONTAINER_NOT_FOUND,
	GS_ERROR_TXN_CONTAINER_SCHEMA_UNMATCH,
	GS_ERROR_TXN_CONTAINER_TYPE_INVALID,
	GS_ERROR_TXN_REPLICATION_SEND_FAILED,  
	GS_ERROR_TXN_REPLICATION_ACK_TIMEOUT,  
	GS_ERROR_TXN_REPLICATION_CONTEXT_INVALID,
	GS_ERROR_TXN_REPLICATION_FAILED,
	GS_ERROR_TXN_ASYNC_REPLICATION_SEND_FAILED,  
	GS_ERROR_TXN_ASYNC_REPLICATION_FAILED,		 
	GS_ERROR_TXN_REPLICATION_LOG_TYPE_INVALID,
	GS_ERROR_TXN_REPLICATION_LOG_LSN_INVALID,
	GS_ERROR_TXN_REPLICATION_LOG_REDO_FAILED,
	GS_ERROR_TXN_REPLICATION_LOG_APPLY_FAILED,
	GS_ERROR_TXN_PREPARE_CHECKPOINT_FAILED,   
	GS_ERROR_TXN_START_CHECKPOINT_FAILED,	 
	GS_ERROR_TXN_COPY_CHUNK_FAILED,			  
	GS_ERROR_TXN_COMPLETE_CHECKPOINT_FAILED,  
	GS_ERROR_TXN_CONSISTENCY_TYPE_UNMATCH,
	GS_ERROR_TXN_CONTAINER_NOT_FOUND_ON_COMMIT,
	GS_ERROR_TXN_CONTAINER_NOT_FOUND_ON_ABORT,
	GS_ERROR_TXN_CONTAINER_NOT_FOUND_ON_EVENT_NOTIFY,
	GS_ERROR_TXN_CONTAINER_NOT_FOUND_ON_REDO,
	GS_ERROR_TXN_DECODE_FAILED,
	GS_ERROR_TXN_ENCODE_FAILED,
	GS_ERROR_TXN_EVENT_NOTIFY_URL_METHOD_INVALID,
	GS_ERROR_TXN_EVENT_NOTIFY_URL_HOST_INVALID,
	GS_ERROR_TXN_EVENT_NOTIFY_URL_INVALID,
	GS_ERROR_TXN_EVENT_NOTIFY_FAILED,				  
	GS_ERROR_TXN_EVENT_NOTIFY_FAILED_CRITICAL,		  
	GS_ERROR_TXN_EVENT_NOTIFY_REQUEST_FAILED,		  
	GS_ERROR_TXN_EVENT_NOTIFY_CONNECT_TIMEOUT,		  
	GS_ERROR_TXN_EVENT_NOTIFY_SEND_REQUEST_TIMEOUT,   
	GS_ERROR_TXN_EVENT_NOTIFY_RECV_RESPONSE_TIMEOUT,  
	GS_ERROR_TXN_COLLECT_TIMEOUT_SESSION_FAILED,
	GS_ERROR_TXN_COLLECT_TIMEOUT_TRANSACTION_FAILED,
	GS_ERROR_TXN_PARTITION_GROUP_LOCK_CONFLICT,
	GS_ERROR_TXN_PARTITION_LOCK_CONFLICT,
	GS_ERROR_TXN_CLUSTER_NAME_INVALID,
	GS_ERROR_TXN_CLIENT_VERSION_NOT_ACCEPTABLE,  
	GS_ERROR_TXN_STATEMENT_TYPE_UNSUPPORTED,  
	GS_ERROR_TXN_CHANGE_CONTAINER_FAILED,  
	GS_ERROR_TXN_PARTITION_STATE_INVALID,  
	GS_ERROR_TXN_PARTITION_TABLE_TYPE_INVALID,  
	GS_ERROR_TXN_PARTITION_TABLE_REVISION_UNMATCH,  
	GS_ERROR_TXN_REQUEST_SHORTTERM_SYNC_FAILED,  
	GS_ERROR_TXN_REQUEST_LONGTERM_SYNC_FAILED,   
	GS_ERROR_REQUEST_CHANGE_PARTITION_TABLE_FAILED,  
	GS_ERROR_REQUEST_DROP_PARTITION_FAILED,  
	GS_ERROR_TXN_STATEMENT_QUEUE_LIMIT_EXCEEDED,  
	GS_ERROR_TXN_PARTITION_ID_INVALID,  
	GS_ERROR_TXN_SERVICE_NOT_INITIALIZED,
	GS_ERROR_TXN_OPTION_TYPE_INVALID,
	GS_ERROR_TXN_RESULT_TYPE_INVALID,
	GS_ERROR_TXN_COLLECT_TIMEOUT_REPLICATION_FAILED,
	GS_ERROR_TXN_REPLICATION_MSG_VERSION_NOT_ACCEPTABLE,	
	GS_ERROR_TXN_REQUEST_GET_CONTAINER_NAME_LIST_FAILED,
	GS_ERROR_TXN_REPLICATION_ACK_FAILED,
	GS_ERROR_TXN_REPLICATION_REPLY_CLIENT_FAILED,
	GS_ERROR_TXN_CANCELLED,
	GS_ERROR_TXN_AUTHENTICATION_SERVICE_NOT_READY,
	GS_ERROR_TXN_AUTHENTICATION_MSG_VERSION_NOT_ACCEPTABLE,	
	GS_ERROR_TXN_USER_NAME_ALREADY_EXISTS,
	GS_ERROR_TXN_DATABASE_NAME_ALREADY_EXISTS,
	GS_ERROR_TXN_OPERATION_NOT_ALLOWED,
	GS_ERROR_TXN_USER_NAME_INVALID,
	GS_ERROR_TXN_DATABASE_NAME_INVALID,
	GS_ERROR_TXN_USER_LIMIT_OVER,
	GS_ERROR_TXN_DATABASE_LIMIT_OVER,
	GS_ERROR_TXN_CURRENT_USER_REMOVED,
	GS_ERROR_TXN_CURRENT_DATABASE_REMOVED,
	GS_ERROR_TXN_USER_NOT_EXIST,
	GS_ERROR_TXN_DATABASE_NOT_EXIST,
	GS_ERROR_TXN_USER_OR_DATABASE_NOT_EXIST,  
	GS_ERROR_TXN_MESSAGE_INVALID,
	GS_ERROR_TXN_OTHER_PRIVILEGE_EXISTS,
	GS_ERROR_TXN_REAUTHENTICATION_FIRED,
	GS_ERROR_TXN_AUTHENTICATION_TIMEOUT,
	GS_ERROR_TXN_CONTAINER_ATTRIBUTE_UNMATCH,
	GS_ERROR_TXN_CONTAINER_PROPERTY_INVALID,
	GS_ERROR_TXN_INDEX_ALREADY_EXISTS,
	GS_ERROR_TXN_INDEX_NOT_FOUND,
	GS_ERROR_TXN_REPLICATION_LOG_VERSION_NOT_ACCEPTABLE,
	GS_ERROR_TXN_DATABASE_UNMATCH,
	GS_ERROR_TXN_DB_ACCESS_INVALID,

	GS_ERROR_SYNC_SERVICE_START_FAILED = 20000,  
	GS_ERROR_SYNC_SERVICE_ENCODE_FAILED,		 
	GS_ERROR_SYNC_SERVICE_ENCODE_MESSAGE_FAILED,  
	GS_ERROR_SYNC_SERVICE_DECODE_MESSAGE_FAILED,  
	GS_ERROR_SYNC_PREPARE_SYNC,					  
	GS_ERROR_SYNC_SYNCMESSAGE_FAILED,			  
	GS_ERROR_SYNC_NODEKEYHANDLER_INIT,			  
	GS_ERROR_SYNC_HANDLER_FAILED,				  
	GS_ERROR_SYNC_NETLOG_APPLYLOG_FAILED,  
	GS_ERROR_SYNC_NETCHUNK_APPLYCHUNK_FAILED,  
	GS_ERROR_SYNC_NETLOG_SEND_FAILED,		   
	GS_ERROR_SYNC_NETCHUNK_SEND_FAILED,		   
	GS_ERROR_SYNC_PARTITION_CREATE_FAILED,  
	GS_ERROR_SYNC_SHORTTERM_SYNC_FAILED,
	GS_ERROR_SYNC_LONGTERM_SYNC_FAILED,
	GS_ERROR_SYNC_EVENT_TYPE_INVALID,  
	GS_ERROR_SYNC_PARTITION_INACTIVE,  
	GS_ERROR_SYNC_CLUSTER_ROLE_UNMATCH,  
	GS_ERROR_SYNC_PARTITION_ROLE_UNMATCH,  
	GS_ERROR_SYNC_PARTITION_STATE_UNMATCH,  
	GS_ERROR_SYNC_PARTITION_TABLE_REVISION_UNMATCH,  
	GS_ERROR_SYNC_LOG_NOT_FOUND,		   
	GS_ERROR_SYNC_LOG_GET_FAILED,		   
	GS_ERROR_SYNC_CHUNK_GET_FAILED,		   
	GS_ERROR_SYNC_CP_START_LOG_NOT_FOUND,  
	GS_ERROR_SYNC_CP_START_LOG_GET_FAILED,  
	GS_ERROR_SYNC_LSN_INVALID,  
	GS_ERROR_SYNC_REDO_FAILED,  
	GS_ERROR_SYNC_PARTITION_ID_INVALID,  

	GS_ERROR_SYNC_INVALID_SENDER_ND,
	GS_ERROR_SYNC_TIMER_SET_FAILED,
	GS_ERROR_SYNC_INVALID_CATCHUP_INFO,
	GS_ERROR_SYNC_NO_CHUNK_GET_FAILED,
	GS_ERROR_SYNC_TIMEOUT_ERROR,
	GS_ERROR_SYNC_CONTEXT_ALREADY_REMOVED,
	GS_ERROR_SYNC_SERVICE_NOT_INITIALIZED,
	GS_ERROR_SYNC_SERVICE_UNKNOWN_EVENT_TYPE,
	GS_ERROR_SYNC_CREATE_CONTEXT_FAILED,
	GS_ERROR_SYNC_INVALID_APPLY_CHUNK,
	GS_ERROR_SYNC_OWNER_BACKUP_INVALID_RELATION,
	GS_ERROR_SYNC_INVALID_CONTEXT,
	GS_ERROR_SYNC_OWNER_MAX_LSN_CONSTRAINT,
	GS_ERROR_SYNC_OWNER_BACKUP_INVALID_LSN_CONSTRAINT,
	GS_ERROR_SYNC_CHECK_LSN,

	GS_ERROR_CP_SERVICE_START_FAILED = 30000,
	GS_ERROR_CP_WRITE_HANDLER_FAILED,
	GS_ERROR_CP_CHECKPOINT_FILE_OPEN_FAILED,
	GS_ERROR_CP_CHECKPOINT_FILE_WRITE_FAILED,
	GS_ERROR_CP_CHECKPOINT_FILE_READ_FAILED,
	GS_ERROR_CP_CHECKPOINT_FILE_FLUSH_FAILED,
	GS_ERROR_CP_LOG_FILE_OPEN_FAILED,
	GS_ERROR_CP_LOG_FILE_WRITE_FAILED,
	GS_ERROR_CP_LOG_FILE_READ_FAILED,
	GS_ERROR_CP_LOG_FILE_FLUSH_FAILED,
	GS_ERROR_CP_WRITE_BUFFER_ILLEAGAL_STATE,
	GS_ERROR_CP_CHUNK_NTH_OUT_OF_RANGE,
	GS_ERROR_CP_PID_CPID_REFCOUNT_IS_INVALID,
	GS_ERROR_CP_FORCE_CHECKPOINT_FAILED,
	GS_ERROR_CP_CONTROLLER_ILLEAGAL_STATE,
	GS_ERROR_CP_CHECKPOINT_FILE_GET_FAILED,
	GS_ERROR_CP_SERVICE_STATE_FAILED,
	GS_ERROR_CP_PARTITION_ID_INVALID,
	GS_ERROR_CP_PARTITION_GROUP_ID_INVALID,
	GS_ERROR_CP_CHECKPOINT_ID_INVALID,
	GS_ERROR_CP_CHECKPOINT_ILLEAGAL_STATE,
	GS_ERROR_CP_START_BACKUP_FAILED,
	GS_ERROR_CP_BACKUP_FAILED,
	GS_ERROR_CP_NORMAL_CHECKPOINT_FAILED,
	GS_ERROR_CP_GROUP_CHECKPOINT_FAILED,
	GS_ERROR_CP_PARTITION_START_FAILED,
	GS_ERROR_CP_PARTITION_END_FAILED,
	GS_ERROR_CP_COPY_CHUNK_FAILED,
	GS_ERROR_CP_WRITE_CHECKPOINT_START_LOG_FAILED,
	GS_ERROR_CP_WRITE_SHUTDOWN_LOG_FAILED,
	GS_ERROR_CP_SERVICE_NOT_INITIALIZED,
	GS_ERROR_CP_WRITE_CHUNK_META_DATA_LOG_FAILED,
	GS_ERROR_CP_WRITE_LSN_INFO_FILE_FAILED,
	GS_ERROR_CP_SET_INCREMENTAL_BACKUP_FILEPOS_FAILED,
	GS_ERROR_CP_LONGTERM_SYNC_FAILED,

	GS_ERROR_CS_SYNC_NO_OWNER = 40000,
	GS_ERROR_CS_INVALID_OWNER_ADDRESS,
	GS_ERROR_CS_SERVICE_START_FAILED,
	GS_ERROR_CS_SERVICE_ENCODE_FAILED,
	GS_ERROR_CS_SERVICE_REQUST_SYNC_FAILED,
	GS_ERROR_CS_SERVICE_SEND_GOAL_FAILED,
	GS_ERROR_CS_SERVICE_REQUEST_GOSSIP_FAILED,
	GS_ERROR_CS_SERVICE_OPERATE_EXCLUDEDNODE_FAILED,
	GS_ERROR_CS_NODEKEYHANDLER_INIT,
	GS_ERROR_CS_SERVICE_ENCODE_MESSAGE_FAILED,
	GS_ERROR_CS_SERVICE_DECODE_MESSAGE_FAILED,
	GS_ERROR_CS_SERVICE_EJECTNODE_FAILED,
	GS_ERROR_CS_SERVICE_SHUTDOWN_FAILED,
	GS_ERROR_CS_SERVICE_SEND_GOSSIP_FAILED,
	GS_ERROR_CS_SERVICE_REQUST_LONGTERMSYNC_FAILED,
	GS_ERROR_CS_SERVICE_REQUEST_GOAL_FAILED,
	GS_ERROR_CS_SERVICE_HEARTBEAT_FAILED,
	GS_ERROR_CS_SERVICE_NOTIFY_FAILED,
	GS_ERROR_CS_SERVICE_UPDATE_PARTITION_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_INTERNAL_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_STATUS_CHANGE_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_CREATE_NEXT_PARTITION_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_CREATE_GOAL_PARTITION_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_WATCH_CLUSTER_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_HANDLER_INTERNAL_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_REQUEST_CALL_FAILED,
	GS_ERROR_CS_SERVICE_CLUSTER_CONSTRUCT_FAILED,
	GS_ERROR_CS_ENCODE_DECODE_VALIDATION_CHECK,
	GS_ERROR_CS_ENCODE_DECODE_VERSION_CHECK,

	GS_ERROR_CS_INVALID_SENDER_ND,
	GS_ERROR_CS_INVALID_ND,
	GS_ERROR_CS_REQUEST_EVENT_FAILED,
	GS_ERROR_CS_SERVICE_NOT_INITIALIZED,
	GS_ERROR_CS_SERVICE_UNKNOWN_EVENT_TYPE,
	GS_ERROR_CS_SERVICE_INITIALIZE_FAILED,
	GS_ERROR_CS_SERVICE_ENCODE_MESSAGE_PACK_FAILED,
	GS_ERROR_CS_SERVICE_DECODE_MESSAGE_PACK_FAILED,
	GS_ERROR_CS_INVALID_CLUSTER_OPERATION_TYPE,
	GS_ERROR_CS_HANDLER_INITIALIZE_FAILED,
	GS_ERROR_CS_GET_INVALID_NODE_ADDRESS,
	GS_ERROR_CS_RESOLVE_NODE_ADDRESS_FAILED,
	GS_ERROR_CS_INVALID_SERVICE_ADDRESS_RELATION,
	GS_ERROR_CS_RESOLVE_NODE_ADDRESS_LIST_FAILED,
	GS_ERROR_CS_INVALID_PARTITION_INFO,
	GS_ERROR_CS_CLUSTER_VERSION_UNMATCHED,
	GS_ERROR_CS_CLUSTER_INVALID_SERVICE_TYPE,
	GS_ERROR_CS_SERVICE_REQUEST_COMPLETE_CHECKPOINT_FAILED,
	GS_ERROR_CS_INVALID_SERVICE_ADDRESS_CONSTRAINT,

#ifdef GD_ENABLE_UNICAST_NOTIFICATION
	GS_ERROR_CS_CONFIG_ERROR,
	GS_ERROR_CS_PROVIDER_TIMEOUT,
	GS_ERROR_CS_ENTRY_ADDRESS_FAILED,
	GS_ERROR_CS_ERROR_INTERNAL,
#endif
	GS_ERROR_CS_MAX_PARTITION_REVISION,

	GS_ERROR_CS_PARTITION_OWNER_NOT_ASSGIN,

	GS_ERROR_SC_UNDEFINED = 50000,
	GS_ERROR_SC_JOIN_CLUSTER_FAILED,
	GS_ERROR_SC_LEAVE_CLUSTER_FAILED,
	GS_ERROR_SC_INCREASE_CLUSTER_FAILED,
	GS_ERROR_SC_DECREASE_CLUSTER_FAILED,
	GS_ERROR_SC_SHUTDOWN_NODE_FAILED,
	GS_ERROR_SC_SHUTDOWN_CLUSTER_FAILED,
	GS_ERROR_SC_EXEC_FATAL,

	GS_ERROR_SC_SERVICE_NOT_INITIALIZED,
	GS_ERROR_SC_DECREASE_CLUSTER_PRECHECK_FAILED,
	GS_ERROR_SC_HOST_FAILED,
	GS_ERROR_SC_PARTITION_FAILED,
	GS_ERROR_SC_GET_CONTAINER_NAME_LIST_FAILED,
	GS_ERROR_SC_SERVICE_CONSTRUCT_FAILED,
	GS_ERROR_SC_BACKUP_NODE_FAILED,
	GS_ERROR_SC_CHECKPOINT_NODE_FAILED,
	GS_ERROR_SC_STAT_FAILED,
	GS_ERROR_SC_SET_TRACE_FAILED,
	GS_ERROR_SC_GET_TRACE_FAILED,
	GS_ERROR_SC_LEAVE_NOT_SAFETY_NODE,

	GS_ERROR_SC_ARCHIVE_LOG_FAILED,
	GS_ERROR_SC_TOO_LARGE_REQUEST,

	GS_ERROR_SC_GOAL_DUPLICATE_PARTITION,
	GS_ERROR_SC_GOAL_NOT_OWNER,
	GS_ERROR_SC_GOAL_RESOLVE_NODE_FAILED,
	GS_ERROR_SC_GOAL_NOT_CLUSTERED_NODE,
	GS_ERROR_SC_GOAL_INVALID_FORMAT,

	GS_ERROR_DS_UNDEFINED = 60000,
	GS_ERROR_DS_DS_STATEMENT_FAILED,
	GS_ERROR_DS_DS_VERSION_INVALID,
	GS_ERROR_DS_DS_OPEN_FAILED,
	GS_ERROR_DS_DS_DATA_DIRECTORY_CREATE_FAILED,
	GS_ERROR_DS_DS_CONTAINER_ID_INVALID,
	GS_ERROR_DS_DS_CHUNK_SIZE_INVALID,
	GS_ERROR_DS_DS_PARTITION_NUM_INVALID,
	GS_ERROR_DS_DS_PARTITION_GROUP_NUM_INVALID,
	GS_ERROR_DS_DS_REDO_FAILED,
	GS_ERROR_DS_DS_REDO_INVALID,
	GS_ERROR_DS_DS_CHUNK_OFFSET_INVALID,
	GS_ERROR_DS_DS_ROW_LOCKED,
	GS_ERROR_DS_DS_DROP_PARTITION_FAILED,
	GS_ERROR_DS_DS_RESTORE_FAILED,
	GS_ERROR_DS_DS_SCHEMA_INVALID,
	GS_ERROR_DS_DS_CHANGE_SCHEMA_DISABLE,
	GS_ERROR_DS_DS_CHANGE_COLLECTION_SCHEMA_FAILED,
	GS_ERROR_DS_DS_CREATE_COLLECTION_FAILED,
	GS_ERROR_DS_DS_DROP_COLLECTION_FAILED,
	GS_ERROR_DS_DS_GET_COLLECTION_FAILED,
	GS_ERROR_DS_DS_CREATE_TIME_SERIES_FAILED,
	GS_ERROR_DS_DS_DROP_TIME_SERIES_FAILED,
	GS_ERROR_DS_DS_GET_TIME_SERIES_FAILED,
	GS_ERROR_DS_DS_CHANGE_TIME_SERIES_SCHEMA_FAILED,
	GS_ERROR_DS_DS_CONTAINER_NAME_INVALID,
	GS_ERROR_DS_DS_CONTAINER_TYPE_INVALID,
	GS_ERROR_DS_DS_PARAMETER_INVALID,
	GS_ERROR_DS_CONTAINER_NOT_FOUND,
	GS_ERROR_DS_OM_BAD_ADDRESS,
	GS_ERROR_DS_OA_DOUBLE_FREE,
	GS_ERROR_DS_OM_OPEN_DUMP_FILE_FAILED,
	GS_ERROR_DS_CM_PARTITION_ID_INVALID,
	GS_ERROR_DS_CM_CHUNK_ID_INVALID,
	GS_ERROR_DS_CM_EXPIRATION_TIME_INVALID,
	GS_ERROR_DS_OM_PARTITION_GROUP_INVALID,
	GS_ERROR_DS_CM_OPEN_SWAP_FILE_FAILED,
	GS_ERROR_DS_CM_READ_CHUNK_FAILED,
	GS_ERROR_DS_CM_WRITE_CHUNK_FAILED,
	GS_ERROR_DS_CM_CHUNK_NUM_LIMIT,
	GS_ERROR_DS_CM_SWAP_DIRECTORY_CREATE_FAILED,
	GS_ERROR_DS_CM_CHUNK_CHECKSUM_INVALID,
	GS_ERROR_DS_COL_INDEXINFO_INVALID,
	GS_ERROR_DS_COL_CREATE_INDEX_FAILED,
	GS_ERROR_DS_COL_DROP_INDEX_FAILED,
	GS_ERROR_DS_COL_GET_COLINFO_FAILED,
	GS_ERROR_DS_COL_ROWDATA_INVALID,
	GS_ERROR_DS_COL_PUT_ROW_FAILED,
	GS_ERROR_DS_COL_PUT_ROWLIST_FAILED,
	GS_ERROR_DS_COL_ROWKEY_INVALID,
	GS_ERROR_DS_COL_ROWKEY_UNDEFINED,
	GS_ERROR_DS_COL_ROWID_INVALID,
	GS_ERROR_DS_COL_DELETE_ROW_FAILED,
	GS_ERROR_DS_COL_UPDATE_ROW_FAILED,
	GS_ERROR_DS_COL_LOCK_CONFLICT,
	GS_ERROR_DS_COL_NOLOCK,
	GS_ERROR_DS_COL_COMMIT_FAILED,
	GS_ERROR_DS_COL_ABORT_FAILED,
	GS_ERROR_DS_COL_PUT_EVENT_NOTIFICATIOIN_FAILED,
	GS_ERROR_DS_COL_DELETE_EVENT_NOTIFICATIOIN_FAILED,
	GS_ERROR_DS_COL_GET_EVENT_NOTIFICATIOIN_FAILED,
	GS_ERROR_DS_TIM_CREATE_INDEX_FAILED,
	GS_ERROR_DS_TIM_DROP_INDEX_FAILED,
	GS_ERROR_DS_TIM_GET_COLINFO_FAILED,
	GS_ERROR_DS_TIM_LOCK_CONFLICT,
	GS_ERROR_DS_TIM_APPEND_ROW_FAILED,
	GS_ERROR_DS_TIM_PUT_ROW_FAILED,
	GS_ERROR_DS_TIM_PUT_ROWLIST_FAILED,
	GS_ERROR_DS_TIM_DELETE_ROW_FAILED,
	GS_ERROR_DS_TIM_COMMIT_FAILED,
	GS_ERROR_DS_TIM_ABORT_FAILED,
	GS_ERROR_DS_TIM_PUT_EVENT_NOTIFICATIOIN_FAILED,
	GS_ERROR_DS_TIM_DELETE_EVENT_NOTIFICATIOIN_FAILED,
	GS_ERROR_DS_TIM_GET_EVENT_NOTIFICATIOIN_FAILED,
	GS_ERROR_DS_TIM_SAMPLING_TIME_UNIT_INVALID,
	GS_ERROR_DS_TIM_INTERPOLATED_COLUMN_TYPE_INVALID,
	GS_ERROR_DS_TIM_INTERPOLATED_COLUMN_IDLIST_INVALID,
	GS_ERROR_DS_TIM_PUT_ROW_ERROR,
	GS_ERROR_DS_TIM_ROW_KEY_INVALID,
	GS_ERROR_DS_TIM_ROW_DATA_INVALID,
	GS_ERROR_DS_TIM_INDEXINFO_INVALID,
	GS_ERROR_DS_TIM_CREATEINDEX_ON_ROWKEY,
	GS_ERROR_DS_TIM_DROPINDEX_ON_ROWKEY,
	GS_ERROR_DS_TIM_NOLOCK,
	GS_ERROR_DS_TIM_INVALID_SCHEMA_OPTION,
	GS_ERROR_DS_TIM_CHANGE_SCHEMA_TIMEOUT,
	GS_ERROR_DS_TIM_UPDATE_INVALID,
	GS_ERROR_DS_TM_INSERT_FAILED,
	GS_ERROR_DS_TM_REMOVE_FAILED,
	GS_ERROR_DS_TM_UPDATE_FAILED,
	GS_ERROR_DS_TM_SEARCH_FAILED,
	GS_ERROR_DS_HM_INSERT_FAILED,
	GS_ERROR_DS_HM_REMOVE_FAILED,
	GS_ERROR_DS_HM_UPDATE_FAILED,
	GS_ERROR_DS_HM_SEARCH_FAILED,
	GS_ERROR_DS_HM_UNEXPECTED_ERROR,
	GS_ERROR_DS_HM_MAX_COLLISION_SIZE_OVER,
	GS_ERROR_DS_HM_MAX_ARRY_SIZE_OVER,
	GS_ERROR_DS_TYPE_INVALID,
	GS_ERROR_DS_KEY_RANGE_INVALID,
	GS_ERROR_DS_AGGREGATED_COLUMN_TYPE_INVALID,
	GS_ERROR_DS_FILTERING_CONDITION_INVALID,
	GS_ERROR_DS_COLUMN_ID_INVALID,
	GS_ERROR_DS_ARRAY_INDEX_INVALID,
	GS_ERROR_DS_CM_OPEN_CHUNK_IMAGE_FILE_FAILED,
	GS_ERROR_DS_CM_CHUNK_IMAGE_DIRECTORY_CREATE_FAILED,
	GS_ERROR_DS_CM_GET_CHUNK_FAILED,
	GS_ERROR_DS_COL_HIT_COUNT_INVALID,
	GS_ERROR_DS_TIM_HIT_COUNT_INVALID,
	GS_ERROR_DS_DS_GET_CONTAINER_LIST_FAILED,
	GS_ERROR_DS_CM_START_GROUP_CHECKPOINT_FAILED,
	GS_ERROR_DS_CM_END_GROUP_CHECKPOINT_FAILED,
	GS_ERROR_DS_CM_START_PARTITION_CHECKPOINT_FAILED,
	GS_ERROR_DS_CM_END_PARTITION_CHECKPOINT_FAILED,
	GS_ERROR_DS_CM_CHECKPOINT_ID_INVALID,
	GS_ERROR_DS_CM_NO_CHUNK_IMAGE,
	GS_ERROR_DS_CM_ANOTHER_SYNC_RUNNING,		
	GS_ERROR_DS_CM_PARTITION_GROUP_ID_INVALID,  
	GS_ERROR_DS_CM_COPY_CHUNK_FAILED,
	GS_ERROR_DS_CM_RECOVERY_FAILED,
	GS_ERROR_DS_OM_FREE_TYPE_INVALID,  
	GS_ERROR_DS_COL_GET_INDEX_INFO_LIST_FAILED,
	GS_ERROR_DS_TIM_GET_INDEX_INFO_LIST_FAILED,
	GS_ERROR_DS_CM_SWAP_CHUNK_FAILED,  
	GS_ERROR_DS_CM_INVALID_KICK_MODE,
	GS_ERROR_DS_CM_CP_FILE_INVALID,  
	GS_ERROR_DS_CM_BACKUP_CHUNK_FAILED,
	GS_ERROR_DS_CM_CHECKPOINT_FILE_FLUSH_FAILED,
	GS_ERROR_DS_CM_CHUNK_IMAGE_DIRECTORY_IS_NOT_DIRECTORY,
	GS_ERROR_DS_CM_CHUNK_IMAGE_DIRECTORY_NOT_FOUND,
	GS_ERROR_DS_CM_CHUNK_CHECKPOINT_ID_INVALID,
	GS_ERROR_DS_HICOMPRESSION_INVALID,
	GS_ERROR_DS_DS_RESULT_ID_INVALID,  
	GS_ERROR_DS_FETCH_START_POS_INVALID,
	GS_ERROR_DS_PUT_TRIGGER_FAILED,
	GS_ERROR_DS_UPDATE_TRIGGER_FAILED,
	GS_ERROR_DS_DELETE_TRIGGER_FAILED,
	GS_ERROR_DS_GET_TRIGGER_FAILED,
	GS_ERROR_DS_PARSE_TRIGGER_FAILED,
	GS_ERROR_DS_INVALID_MVCC_MAP,
	GS_ERROR_DS_OM_INVALID,
	GS_ERROR_DS_COL_GET_LOCK_ID_INVALID,
	GS_ERROR_DS_TIM_GET_LOCK_ID_INVALID,
	GS_ERROR_DS_TIM_INVALID_ROW_ACCESS,
	GS_ERROR_DS_CON_GET_ROW_ID_LIST_FAILED,
	GS_ERROR_DS_CON_GET_OID_LIST_FAILED,
	GS_ERROR_DS_RS_PARTIAL_RS_CONTAINER_ALREADY_CLOSED,
	GS_ERROR_DS_CON_GET_ROW_LIST_FAILED,
	GS_ERROR_DS_UNEXPECTED_ERROR,
	GS_ERROR_DS_DS_SCHEMA_CHANGE_INVALID,
	GS_ERROR_DS_TIM_UPDATE_ROW_INVALID,
	GS_ERROR_DS_CON_STATUS_INVALID,
	GS_ERROR_DS_OUT_OF_RANGE,
	GS_ERROR_DS_CON_ACCESS_INVALID,
	GS_ERROR_CON_PUT_ROW_OPTION_INVALID,  
	GS_ERROR_DS_FETCH_PARAMETER_INVALID,
	GS_ERROR_DS_UNUSED1,  
	GS_ERROR_DS_CONTAINER_UNEXPECTEDLY_REMOVED,
	GS_ERROR_DS_CONTAINER_TYPE_UNKNOWN,
	GS_ERROR_DS_INPUT_MESSAGE_INVALID,
	GS_ERROR_DS_BACKGROUND_TASK_INVALID,
	GS_ERROR_DS_DS_CONTAINER_EXPIRED,
	GS_ERROR_DS_DS_PURGE_DATA_AFFINITY_INFO_FAILED,
	GS_ERROR_DS_DS_ARCHIVE_FAILED,
	GS_ERROR_DS_DS_ARCHIVE_INFO,
	GS_ERROR_VC_CONSTRUCT_FAILED = 65000,
	GS_ERROR_VC_INVALID_CONATAINER,
	GS_ERROR_VC_CREATE_CONTAINER_FAILED,
	GS_ERROR_VC_DROP_CONTAINER_FAILED,
	GS_ERROR_VC_SEARCH_FAILED,
	GS_ERROR_VC_PUTROW_FAILED,
	GS_ERROR_VC_INVALID_CREATE_CONTAINER_SCHEMA,
	GS_ERROR_VC_INVALID_CREATE_INDEX_PARAMS,
	GS_ERROR_VC_INVALID_SEARCH_PARAMS,
	GS_ERROR_VC_CREATE_INDEX_FAILED,
	GS_ERROR_VC_NOT_SUPPORT_OPERATION,
	GS_ERROR_VC_CONTAINER_NOT_FOUND,
	GS_ERROR_VC_INVALID_ROW_FIELD,
	GS_ERROR_VC_SERIALIZATION_FAILED,
	GS_ERROR_VC_INVALID_DATA,
	GS_ERROR_VC_CHANGE_PARAMETER_FAILED,

	GS_ERROR_OM_UNDEFINED = 68000,
	GS_ERROR_OM_INVALID_CHUNK_EXP_SIZE,  
	GS_ERROR_OM_INVALID_HEADER_OFFSET,
	GS_ERROR_OM_INVALID_PARTITION_GROUP_ID,  
	GS_ERROR_OM_INVALID_PARTITION_ID,		 
	GS_ERROR_OM_UNDEFINED_OID,				 
	GS_ERROR_OM_INVALID_OID,
	GS_ERROR_OM_INVALID_REQUEST_SIZE,  
	GS_ERROR_OM_CONSTRUCTOR_FAILED,
	GS_ERROR_OM_ALLOCATE_FAILED,  
	GS_ERROR_OM_FREE_FAILED,	  
	GS_ERROR_OM_UPDATE_FAILED,	
	GS_ERROR_OM_GET_FAILED,		  
	GS_ERROR_OM_INITIALIZE_PARTITION_FAILED,
	GS_ERROR_OM_DROP_PARTITION_FAILED,			
	GS_ERROR_OM_FREE_LAST_LATCH_MEMORY_FAILED,  
	GS_ERROR_OM_DUMP_FAILED,					
	GS_ERROR_OM_OID_LIMIT_OVER,					
	GS_ERROR_OA_INVALID_CHUNK_SIZE,	
	GS_ERROR_OA_NON_ALLOCATED_OBJECT,  
	GS_ERROR_OA_NO_ROOM,
	GS_ERROR_OA_CONSTRUCTOR_FAILED,
	GS_ERROR_OA_ALLOCATE_FAILED,
	GS_ERROR_CHM_INVALID_VERSION,
	GS_ERROR_CHM_INVALID_PARTITION_NUM,
	GS_ERROR_CHM_INVALID_PARTITION_ID,
	GS_ERROR_CHM_INVALID_CHUNK_SIZE,
	GS_ERROR_CHM_INVALID_CHUNK_ID,
	GS_ERROR_CHM_INVALID_CHUNK_ATTRIBUTE,
	GS_ERROR_CHM_INVALID_CHUNK_CATEGORY_ID,
	GS_ERROR_CHM_INVALID_CHUNK_KEY,
	GS_ERROR_CHM_INVALID_CHUNK_CHECKSUM,
	GS_ERROR_CHM_INVALID_FILE_POS,
	GS_ERROR_CHM_INVALID_CHECKPOINT_ID,
	GS_ERROR_CHM_INVALID_KICK_MODE,
	GS_ERROR_CHM_INVALID_CHUNK_CATEGORY_RANGE_NUM,  
	GS_ERROR_CHM_INVALID_STORE_MEMORY_LIMIT,
	GS_ERROR_CHM_CONSTRUCTOR_FAILED,  
	GS_ERROR_CHM_LATCH_UNLATCH_FAILED,
	GS_ERROR_CHM_START_PARTITION_GROUP_CHECKPOINT_FAILED,  
	GS_ERROR_CHM_END_PARTITION_GROUP_CHECKPOINT_FAILED,	
	GS_ERROR_CHM_START_PARTITION_CHECKPOINT_FAILED,		   
	GS_ERROR_CHM_END_PARTITION_CHECKPOINT_FAILED,		   
	GS_ERROR_CHM_COPY_CHUNK_FAILED,						   
	GS_ERROR_CHM_RECOVERY_FAILED,						   
	GS_ERROR_CHM_BACKUP_FAILED,  
	GS_ERROR_CHM_INITIALIZE_PARTITION_FAILED,
	GS_ERROR_CHM_IO_FAILED,
	GS_ERROR_CHM_MAX_CHUNK_ID,
	GS_ERROR_CF_NO_FILE,
	GS_ERROR_CF_INVALID_FILE_NAME,
	GS_ERROR_CF_INVALID_DIRECTORY,
	GS_ERROR_CF_CONSTRUCTOR_FAILED,
	GS_ERROR_CF_CREATE_FILE_FAILED,
	GS_ERROR_CF_OPEN_FILE_FAILED,
	GS_ERROR_CF_READ_CHUNK_FAILED,
	GS_ERROR_CF_WRITE_CHUNK_FAILED,
	GS_ERROR_CF_FLUSH_CHUNK_FAILED,
	GS_ERROR_OA_BAD_ADDRESS,
	GS_ERROR_OA_DOUBLE_FREE,
	GS_ERROR_OM_INVALID_OBJECT,
	GS_ERROR_CHM_DROP_PARTITION_FAILED,			
	GS_ERROR_CHM_CHECKPOINT_FILE_FLUSH_FAILED,  
	GS_ERROR_CHM_NO_CHUNK_IMAGE,
	GS_ERROR_CHM_CHECK_CHUNK_FAILED,		  
	GS_ERROR_CHM_SYNC_FAILED,				  
	GS_ERROR_CHM_DUMP_FAILED,				  
	GS_ERROR_CHM_INVALID_PARTIAL_CHUNK_SIZE,  
	GS_ERROR_CHM_GET_CHUNK_TABLE_INFO_FAILED,
	GS_ERROR_CHM_SEARCH_CHUNK_FAILED,  
	GS_ERROR_CHM_INVALID_CHUNK_CATEGORY_NUM,
	GS_ERROR_CHM_CID_LIMIT_OVER,
	GS_ERROR_CHM_INVALID_CHECKPOINT_MEMORY_LIMIT,
	GS_ERROR_CHM_GET_CHECKPOINT_CHUNK_FAILED,
	GS_ERROR_CHM_COMPRESSION_FAILED,
	GS_ERROR_CHM_UNCOMPRESSION_FAILED,
	GS_ERROR_CHM_INCOMPATIBLE_ZLIB_VERSION,
	GS_ERROR_CHM_INVALID_SPLIT_COUNT,
	GS_ERROR_CHM_INVALID_SPLIT_STRIPE_SIZE,

	GS_ERROR_QP_UNDEFINED = 70000,
	GS_ERROR_QP_ROW_KEY_UNDEFINED,
	GS_ERROR_QP_ROW_KEY_INVALID,
	GS_ERROR_QP_FOR_UPDATE_INVALID,
	GS_ERROR_QP_INTERVAL_INVALID,
	GS_ERROR_QP_INTERPOLATED_COLUMN_IDLIST_EMPTY,
	GS_ERROR_QP_COLUMN_ID_INVALID,
	GS_ERROR_QP_TIMESTAMP_RANGE_INVALID,
	GS_ERROR_QP_COL_GET_FAILED,
	GS_ERROR_QP_TIM_SEARCH_FAILED,
	GS_ERROR_QP_TIM_SAMPLE_FAILED,
	GS_ERROR_QP_TIM_AGGREGATE_FAILED,
	GS_ERROR_QP_TIM_GET_FAILED,
	GS_ERROR_QP_TIM_INTERPOLATE_FAILED,
	GS_ERROR_QP_HIT_COUNT_INVALID,
	GS_ERROR_QP_COL_EXPORT_FAILED,
	GS_ERROR_QP_TIME_EXPORT_FAILED,
	GS_ERROR_QP_COL_RANGE_FAILED,
	GS_ERROR_QP_COL_QUERY_FAILED,
	GS_ERROR_QP_TIM_QUERY_FAILED,
	GS_ERROR_QP_SEARCH_GEOM_FAILED,
	GS_ERROR_QP_SEARCH_GEOM_RELATED_FAILED,
	GS_ERROR_QP_FETCH_FAILED,

	GS_ERROR_QF_VALUE_OVERFLOW = 75000,
	GS_ERROR_QF_DIVIDE_BY_ZERO,
	GS_ERROR_QF_VALUE_OUT_OF_RANGE,

	GS_ERROR_LM_WRITE_LOG_FAILED = 80000,
	GS_ERROR_LM_FLUSH_FAILED,
	GS_ERROR_LM_PARSE_LOG_FAILED,
	GS_ERROR_LM_GET_LOG_FAILED,
	GS_ERROR_LM_GET_LOG_LIST_FAILED,
	GS_ERROR_LM_OPEN_LOG_FILE_FAILED,
	GS_ERROR_LM_READ_LOG_BLOCK_FAILED,
	GS_ERROR_LM_WRITE_LOG_BLOCK_FAILED,
	GS_ERROR_LM_SYNC_LOG_FILE_FAILED,
	GS_ERROR_LM_CREATE_LOG_FILE_FAILED,
	GS_ERROR_LM_PREPARE_CHECKPOINT_FAILED,
	GS_ERROR_LM_POST_CHECKPOINT_FAILED,
	GS_ERROR_LM_LOG_FILES_CONFIGURATION_UNMATCHED,
	GS_ERROR_LM_LOG_FILE_NOT_FOUND,
	GS_ERROR_LM_LOCK_LOG_FILE_FAILED,
	GS_ERROR_LM_UNLOCK_LOG_FILE_FAILED,
	GS_ERROR_LM_REMOVE_LOGFILE_FAILED,
	GS_ERROR_LM_COPY_LOG_FILE_FAILED,
	GS_ERROR_LM_CLOSE_LOG_FILE_FAILED,
	GS_ERROR_LM_INVALID_LOG_BLOCK,
	GS_ERROR_LM_INVALID_LOG_RECORD,
	GS_ERROR_LM_INVALID_LOG_INDEX,
	GS_ERROR_LM_LOG_FILE_VERSION_UNMATCHED,
	GS_ERROR_LM_INTERNAL_ERROR_OTHER = 80500,
	GS_ERROR_LM_INTERNAL_INVALID_ARGUMENT,

	GS_ERROR_PT_CREATE_FAILED = 90000,
	GS_ERROR_PT_GETNODE_DESCRIPTOR,
	GS_ERROR_PT_UPDATE_SYNC_PARTITION,
	GS_ERROR_PT_UPDATE_GOAL_PARTITION,
	GS_ERROR_PT_INVALID_NODE_ADDRESS,
	GS_ERROR_PT_SET_INVALID_NODE_ID,
	GS_ERROR_PT_INVALID_PARTITION_ROLE_TYPE,
	GS_ERROR_PT_CHECK_PARTITION_STATUS_FAILED,
	GS_ERROR_PT_CHECK_PARTITION_RELATION_FAILED,
	GS_ERROR_PT_FILTER_PARTITION_FAILED,
	GS_ERROR_PT_INTERNAL,

	GS_ERROR_CT_PARAMETER_FILE_LOAD_FAILED = 100000,
	GS_ERROR_CT_PARAMETER_FILE_TOO_LARGE,
	GS_ERROR_CT_PARAMETER_INVALID,
	GS_ERROR_CT_PARAMETER_LESS_THAN_LOWER_LIMIT,
	GS_ERROR_CT_PARAMETER_GREATER_THAN_UPPER_LIMIT,
	GS_ERROR_CT_PARAMETER_TYPE_MISMATCH,

	GS_ERROR_TM_MODULE_CREATE_FAILED = 110000,
	GS_ERROR_TM_PARTITION_ALREADY_EXISTS,  
	GS_ERROR_TM_PARTITION_CREATE_FAILED,
	GS_ERROR_TM_SESSION_NOT_FOUND,
	GS_ERROR_TM_SESSION_INVALID,
	GS_ERROR_TM_TRANSACTION_NOT_FOUND,
	GS_ERROR_TM_TRANSACTION_INVALID,  
	GS_ERROR_TM_TRANSACTION_BEGIN_NOT_ALLOWED,
	GS_ERROR_TM_TRANSACTION_COMMIT_NOT_ALLOWED,
	GS_ERROR_TM_TRANSACTION_ABORT_NOT_ALLOWED,
	GS_ERROR_TM_TRANSACTION_ALREADY_BEGIN,
	GS_ERROR_TM_TRANSACTION_ALREADY_COMMITTED,
	GS_ERROR_TM_TRANSACTION_ALREADY_ABORTED,
	GS_ERROR_TM_STATEMENT_ALREADY_EXECUTED,
	GS_ERROR_TM_REDO_FAILED,
	GS_ERROR_TM_SESSION_NOT_CREATED,  
	GS_ERROR_TM_SESSION_UUID_UNMATCHED,
	GS_ERROR_TM_PARTITION_DROP_FAILED,
	GS_ERROR_TM_CONTEXT_PUT_FAILED,
	GS_ERROR_TM_CONTEXT_GET_FAILED,
	GS_ERROR_TM_CONTEXT_REMOVE_FAILED,
	GS_ERROR_TM_TRANSACTION_BEGIN_FAILED,
	GS_ERROR_TM_TRANSACTION_COMMIT_FAILED,
	GS_ERROR_TM_TRANSACTION_ABORT_FAILED,
	GS_ERROR_TM_CONTAINER_LOCK_FAILED,
	GS_ERROR_TM_CONTAINER_UNLOCK_FAILED,
	GS_ERROR_TM_TRANSACTION_ACTIVE_CHECK_FAILED,
	GS_ERROR_TM_TIMEOUT_CHECK_FAILED,
	GS_ERROR_TM_CONTEXT_BACKUP_FAILED,
	GS_ERROR_TM_CONTEXT_RESTORE_FAILED,
	GS_ERROR_TM_CREATION_MODE_INVALID,
	GS_ERROR_TM_TRANSACTION_MODE_INVALID,
	GS_ERROR_TM_REPLICATION_NOT_FOUND,
	GS_ERROR_TM_STATEMENT_INVALID,
	GS_ERROR_TM_TRANSACTION_END_FAILED,
	GS_ERROR_TM_AUTHENTICATION_NOT_FOUND,



	GS_ERROR_EE_MODULE_CREATE_FAILED = 130000,
	GS_ERROR_EE_START_FAILED,
	GS_ERROR_EE_PARAMETER_INVALID,
	GS_ERROR_EE_OPERATION_NOT_ALLOWED,
	GS_ERROR_EE_MULTICAST_ALREADY_EXISTS,
	GS_ERROR_EE_MULTICAST_NOT_EXIST,
	GS_ERROR_EE_MULTICAST_SETUP_FAILED,
	GS_ERROR_EE_CONNECTION_INFORMATION_BROKEN,
	GS_ERROR_EE_CONNECTION_NOT_FOUND,
	GS_ERROR_EE_CONNECT_FAILED,
	GS_ERROR_EE_CONNECT_TIMEOUT,
	GS_ERROR_EE_SEND_FAILED,  
	GS_ERROR_EE_IO_READ_FAILED,
	GS_ERROR_EE_IO_WRITE_FAILED,
	GS_ERROR_EE_IO_POLLING_FAILED,
	GS_ERROR_EE_MESSAGE_INVALID,
	GS_ERROR_EE_HANDLER_LIMIT_EXCEEDED,
	GS_ERROR_EE_HANDLER_ALREADY_EXISTS,
	GS_ERROR_EE_ACKSENDER_REQUIRED,
	GS_ERROR_EE_EVENT_CREATE_FAILED,  
	GS_ERROR_EE_EVENT_DELETE_FAILED,  
	GS_ERROR_EE_EVENT_SCHEDULE_FAILED,
	GS_ERROR_EE_EVENT_ALREADY_SCHEDULED,  
	GS_ERROR_EE_EVENT_QUEUEING_FAILED,	
	GS_ERROR_EE_LISTENER_FAILED,
	GS_ERROR_EE_WORKER_FAILED,
	GS_ERROR_EE_TIMER_FAILED,
	GS_ERROR_EE_HANDLEHINT_INVALID,  
	GS_ERROR_EE_FD_LIMIT_TOO_SMALL,
	GS_ERROR_EE_FD_LIMIT_EXCEEDED,
	GS_ERROR_EE_ND_LIMIT_TOO_SMALL,
	GS_ERROR_EE_ND_LIMIT_EXCEEDED,
	GS_ERROR_EE_TIMER_TYPE_INVALID,
	GS_ERROR_EE_STACK_MEMORY_LIMIT_EXCEEDED,  
	GS_ERROR_EE_REQUEST_ASYNC_FAILED,
	GS_ERROR_EE_REQUEST_SYNC_FAILED,
	GS_ERROR_EE_EVENT_PRIORITY_INVALID,



	GS_ERROR_TQ_NOT_DEFINED_ERROR = 150000,
	GS_ERROR_TQ_ROW_KEY_UNDEFINED,
	GS_ERROR_TQ_FOR_UPDATE_INVALID,
	GS_ERROR_TQ_COL_GET_FAILED,
	GS_ERROR_TQ_TIM_SEARCH_FAILED,
	GS_ERROR_TQ_TIM_SAMPLE_FAILED,
	GS_ERROR_TQ_TIM_AGGREGATE_FAILED,
	GS_ERROR_TQ_TIM_GET_FAILED,
	GS_ERROR_TQ_TIM_INTERPOLATE_FAILED,
	GS_ERROR_TQ_AGGREGATION_FAILED,
	GS_ERROR_TQ_INVALID_COLLECTION_NAME,
	GS_ERROR_TQ_INVALID_NAME,
	GS_ERROR_TQ_COLUMN_NOT_FOUND,
	GS_ERROR_TQ_COLUMN_ABUSE,
	GS_ERROR_TQ_FUNCTION_NOT_FOUND,
	GS_ERROR_TQ_FUNCTION_FAILED,
	GS_ERROR_TQ_DIVIDE_BY_ZERO,
	GS_ERROR_TQ_CANNOT_LOCK_ROW,
	GS_ERROR_TQ_OPERATION_NOT_DEFINED,
	GS_ERROR_TQ_COLUMN_IS_NOT_BOOLEAN,
	GS_ERROR_TQ_COLUMN_CANNOT_AGGREGATE,
	GS_ERROR_TQ_COLUMN_CANNOT_SELECT,

	GS_ERROR_TQ_SYNTAX_ERROR_OTHER = 151000,
	GS_ERROR_TQ_SYNTAX_ERROR_EXECUTION,
	GS_ERROR_TQ_SYNTAX_ERROR_INVALID_TOKEN,
	GS_ERROR_TQ_SYNTAX_ERROR_CANNOT_DEQUOTE,
	GS_ERROR_TQ_SYNTAX_ERROR_INVALID_ORDERBY_EXPR,
	GS_ERROR_TQ_SYNTAX_ERROR_ORDERBY_WITH_AGGREGATION,

	GS_ERROR_TQ_CONSTRAINT_ERROR_OTHER = 152000,
	GS_ERROR_TQ_CONSTRAINT_CANNOT_CAST,
	GS_ERROR_TQ_CONSTRAINT_INVALID_ARGUMENT,
	GS_ERROR_TQ_CONSTRAINT_SELECTION_ABUSE,
	GS_ERROR_TQ_CONSTRAINT_AGGREGATION_ABUSE,
	GS_ERROR_TQ_CONSTRAINT_CANNOT_MAKE_INDEX,
	GS_ERROR_TQ_CONSTRAINT_MAP_NOT_FOUND,
	GS_ERROR_TQ_CONSTRAINT_GIS_CANNOT_MAKE_OBJECT,
	GS_ERROR_TQ_CONSTRAINT_GIS_CANNOT_GET_VALUE,
	GS_ERROR_TQ_CONSTRAINT_ARRAY_OUT_OF_RANGE,
	GS_ERROR_TQ_CONSTRAINT_INVALID_ARGUMENT_TYPE,
	GS_ERROR_TQ_CONSTRAINT_INVALID_ARGUMENT_COUNT,
	GS_ERROR_TQ_CONSTRAINT_INVALID_ARGUMENT_RANGE,

	GS_ERROR_TQ_INTERNAL_ERROR_OTHER = 152500,
	GS_ERROR_TQ_INTERNAL_INVALID_ARGUMENT,
	GS_ERROR_TQ_INTERNAL_NOT_IMPLEMENTED,
	GS_ERROR_TQ_INTERNAL_GIS_ERROR_OTHER,
	GS_ERROR_TQ_INTERNAL_GIS_GET_VALUE_IN_EMPTY_OBJECT,
	GS_ERROR_TQ_INTERNAL_GIS_GET_VALUE_FAILED,
	GS_ERROR_TQ_INTERNAL_GIS_UNKNOWN_RELATIONSHIP,
	GS_ERROR_TQ_INTERNAL_GIS_CANNOT_SERIALIZE,
	GS_ERROR_TQ_INTERNAL_GIS_CANNOT_DESERIALIZE,
	GS_ERROR_TQ_INTERNAL_GIS_TR_PV3_FATAL,
	GS_ERROR_TQ_INTERNAL_DATA_ERROR,
	GS_ERROR_TQ_INTERNAL_LIBRARY_MISUSE,
	GS_ERROR_TQ_INTERNAL_DATA_CANNOT_COMPARE,
	GS_ERROR_TQ_INTERNAL_GIS_LOGIC_ERROR,

	GS_ERROR_TQ_CRITICAL_ERROR_OTHER = 153000,
	GS_ERROR_TQ_CRITICAL_LOGIC_ERROR,
	GS_ERROR_TQ_CRITICAL_MAP_NOT_FOUND,

	GS_ERROR_RM_UNDEFINED = 160000,
	GS_ERROR_RM_GET_CHUNK_FAILED,	  
	GS_ERROR_RM_PUT_CHUNK_FAILED,	  
	GS_ERROR_RM_GET_CHUNK_NUM_FAILED,  
	GS_ERROR_RM_RECOVERY_CHECKPOINT_FAILED,
	GS_ERROR_RM_REDO_LOG_LSN_INVALID,
	GS_ERROR_RM_RECOVERY_FAILED,
	GS_ERROR_RM_CHECKPOINT_ID_UNMATCH,
	GS_ERROR_RM_CHECKPOINT_END_LOG_NOT_FOUND,
	GS_ERROR_RM_REDO_LOG_CONTENT_INVALID,  
	GS_ERROR_RM_RESTORE_TRANSACTION_FAILED,  
	GS_ERROR_RM_DROP_PARTITION_FAILED,  
	GS_ERROR_RM_PARTITION_GROUP_NUM_NOT_MATCH,
	GS_ERROR_RM_LOG_FILE_NOT_FOUND,
	GS_ERROR_RM_LOG_FILE_CP_FILE_MISMATCH,
	GS_ERROR_RM_CP_FILE_WITH_NO_LOG_FILE,
	GS_ERROR_RM_BACKUP_WITH_NO_LOG_FILE,
	GS_ERROR_RM_WRITE_BACKUP_INFO_FILE_FAILED,
	GS_ERROR_RM_READ_BACKUP_INFO_FILE_FAILED,
	GS_ERROR_RM_REMOVE_BACKUP_INFO_FILE_FAILED,
	GS_ERROR_RM_COMPATIBLE_INVALID,
	GS_ERROR_RM_PARTITION_NUM_NOT_MATCH,
	GS_ERROR_RM_UNDO_FAILED,
	GS_ERROR_RM_CONTAINER_NOT_FOUND,
	GS_ERROR_RM_REDO_MODE_INVALID,
	GS_ERROR_RM_INVALID_PARTITION,
	GS_ERROR_RM_ALREADY_APPLY_LOG,
	GS_ERROR_RM_INVALID_CHUNK_DATA,
	GS_ERROR_RM_INVALID_CPFILE_SPLIT_COUNT,
	GS_ERROR_RM_INVALID_FILE_FOUND,
	GS_ERROR_RM_INCOMPLETE_CP_FILE,

	GS_ERROR_TRIG_SERVICE_START_FAILED = 170000,  
	GS_ERROR_TRIG_TYPE_INVALID,					  
	GS_ERROR_TRIG_NAME_INVALID,					  
	GS_ERROR_TRIG_TARGET_OPERATION_INVALID,		  
	GS_ERROR_TRIG_JMS_PROVIDER_INVALID,  
	GS_ERROR_TRIG_JMS_DESTINATION_INVALID,  
	GS_ERROR_TRIG_JMS_DESTINATION_NAME_INVALID,  
	GS_ERROR_TRIG_CHECK_FAILED,		 
	GS_ERROR_TRIG_REST_SEND_FAILED,  
	GS_ERROR_TRIG_JMS_SEND_FAILED,   
	GS_ERROR_TRIG_REST_CHECK_RESPONSE_FAILED,  
	GS_ERROR_TRIG_TIMEOUT,  
	GS_ERROR_TRIG_REQUEST_FAILED,  
	GS_ERROR_TRIG_JMS_CONNECTION_FAILED,  
	GS_ERROR_TRIG_ENCODE_FAILED,
	GS_ERROR_TRIG_DECODE_FAILED,
	GS_ERROR_TRIG_SIZE_INVALID,

	GS_ERROR_CLM_CONSTRUCT_FAILED = 180000,
	GS_ERROR_CLM_NODE_STATUS_CHECK_FAILED,
	GS_ERROR_CLM_CLUSTER_OPERATION_CHECK_FAILED,
	GS_ERROR_CLM_CLUSTER_STATUS_CHECK_FAILED,
	GS_ERROR_CLM_INVALID_OPERAION_TYPE,
	GS_ERROR_CLM_INVALID_CLUSTER_TRANSITION_TYPE,
	GS_ERROR_CLM_UPDATE_CLUSTER_FAILED,
	GS_ERROR_CLM_HEARTBEAT_GET_FAILED,
	GS_ERROR_CLM_HEARTBEAT_SET_FAILED,
	GS_ERROR_CLM_HEARTBEATRES_GET_FAILED,
	GS_ERROR_CLM_HEARTBEATRES_SET_FAILED,
	GS_ERROR_CLM_HEARTBEAT_CHECK_GET_FAILED,
	GS_ERROR_CLM_UPDATE_PARTITION_SET_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTER_GET_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTER_GET_CHECK_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTER_SET_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTER_SET_VALUE_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTER_SET_CHECK_FAILED,
	GS_ERROR_CLM_DETECT_DOUBLE_MASTER,
	GS_ERROR_CLM_NOTIFY_CLUSTERRES_GET_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTERRES_SET_VALUE_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTERRES_SET_FAILED,
	GS_ERROR_CLM_NOTIFY_CLUSTERRES_SET_CHECK_FAILED,
	GS_ERROR_CLM_JOIN_CLUSTER_SET_FAILED,
	GS_ERROR_CLM_JOIN_CLUSTER_SET_CHECK_FAILED,
	GS_ERROR_CLM_LEAVE_CLUSTER_SET_FAILED,
	GS_ERROR_CLM_INCREASE_CLUSTER_SET_FAILED,
	GS_ERROR_CLM_INCREASE_CLUSTER_SET_CHECK_FAILED,
	GS_ERROR_CLM_DECREASE_CLUSTER_SET_FAILED,
	GS_ERROR_CLM_DECREASE_CLUSTER_SET_CHECK_FAILED,
	GS_ERROR_CLM_GET_SAFETY_NODE_FAILED,
	GS_ERROR_CLM_GOSSIP_GET_FAILED,
	GS_ERROR_CLM_GOSSIP_SET_FAILED,
	GS_ERROR_CLM_GOSSIP_SET_CHECK_FAILED,
	GS_ERROR_CLM_CHANGE_PARTITION_STATE_SET_FAILED,
	GS_ERROR_CLM_CHANGE_PARTITION_TABLE_SET_FAILED,
	GS_ERROR_CLM_CHANGE_PARTITION_TABLE_SET_CHECK_FAILED,
	GS_ERROR_CLM_CLUSTER_STATUS_NOT_JOIN_CLUSTER,
	GS_ERROR_CLM_CLUSTER_STATUS_IS_SUBMASTER,
	GS_ERROR_CLM_CLUSTER_STATUS_IS_FOLLOWER,
	GS_ERROR_CLM_CLUSTER_STATUS_NOT_MASTER,
	GS_ERROR_CLM_CLUSTER_STATUS_NOT_FOLLOWER,
	GS_ERROR_CLM_CLUSTER_STATUS_NOT_SUBMASTER,
	GS_ERROR_CLM_CLUSTER_STATUS_ALREADY_JOIN_CLUSTER,
	GS_ERROR_CLM_CLUSTER_IS_PENDING,
	GS_ERROR_CLM_CLUSTER_ALREADY_MAX_NODE,
	GS_ERROR_CLM_CLUSTER_FOLLOWER_IS_STABLE,
	GS_ERROR_CLM_NEW_NODE_NEED_TO_FOLLOW_MASTER,
	GS_ERROR_CLM_UNMATCH_CLUSTER_NAME,
	GS_ERROR_CLM_UNMATCH_RESERVE_NUM,
	GS_ERROR_CLM_UNMATCH_DIGEST,
	GS_ERROR_CLM_INVALID_PARTITION_NUM,
	GS_ERROR_CLM_ALREADY_STABLE,
	GS_ERROR_CLM_JOIN_CLUSTER_INVALID_CLUSTER_NAME,
	GS_ERROR_CLM_JOIN_CLUSTER_UNMATCH_CLUSTER_NAME,
	GS_ERROR_CLM_NOT_STABLE,
	GS_ERROR_CLM_INVALID_NODE_ID,
	GS_ERROR_CLM_PENDING_SHUTDOWN,
	GS_ERROR_CLM_UNACCEPTABLE_CONDITION,
	GS_ERROR_CLM_UNPREPARED_HEARTBEAT,
	GS_ERROR_CLM_STATUS_TO_SUBMASTER,
	GS_ERROR_CLM_STATUS_TO_MASTER,
	GS_ERROR_CLM_RECEIVE_SUBMASTER_HEARTBEAT,
	GS_ERROR_CLM_DETECT_NEW_NODE,
	GS_ERROR_CLM_DETECT_HEARTBEAT_TO_MASTER,
	GS_ERROR_CLM_DETECT_HEARTBEAT_TO_FOLLOWER,
	GS_ERROR_CLM_DETECT_INCLUDE_ALREADY_INVALID_DATA,
	GS_ERROR_CLM_STATUS_TO_FOLLOWER,

	GS_ERROR_SYM_CONSTRUCT_FAILED = 190000,
	GS_ERROR_SYM_INVALID_PARTITION_INFO,
	GS_ERROR_SYM_INVALID_PARTITION_STATUS,
	GS_ERROR_SYM_INVALID_PARTITION_ROLE,
	GS_ERROR_SYM_INVALID_PARTITION_REVISION,
	GS_ERROR_SYM_INVALID_CLUSTER_INFO,
	GS_ERROR_SYM_CREATE_SYNC_CONTEXT_FAILED,
	GS_ERROR_SYM_GET_SYNC_CONTEXT_FAILED,
	GS_ERROR_SYM_REMOVE_SYNC_CONTEXT_FAILED,
	GS_ERROR_SYM_DROP_PARTITION_FAILED,
	GS_ERROR_SYM_CHECK_EXECUTABLE_FAILED,
	GS_ERROR_SYM_SYNC_CONTEXT_TABLE_CONSTRUCTOR_FAILED,
	GS_ERROR_SYM_CREATE_SYNC_CONTEXT_TABLE_FAILED,
	GS_ERROR_SYM_REMOVE_SYNC_CONTEXT_TABLE_FAILED,
	GS_ERROR_SYM_CONTEXT_OPERATION_FAILED,
	GS_ERROR_SYM_CONTEXT_LOG_COPY_FAILED,
	GS_ERROR_SYM_CONTEXT_CHUNK_COPY_FAILED,
	GS_ERROR_SYM_CONTEXT_FREE_LOG_CHUNK_FAILED,
	GS_ERROR_SYM_INVALID_SYNC_TYPE,
	GS_ERROR_SYM_CONTEXT_CLEAR_FAILED

};

/*!
	@brief Trace code
*/
enum TraceCode {
	GS_TRACE_CM_LONG_IO = 1900,
	GS_TRACE_CM_SIMULATE_FAILURE,  
	GS_TRACE_CM_BUILTIN_TEST,	  
	GS_TRACE_CM_LONG_EVENT,
	GS_TRACE_CM_COMPRESSION_FAILED,
	GS_TRACE_CM_INVALID_COMPRESSION,
	GS_TRACE_CM_PARTIAL_IO,

	GS_TRACE_TXN_REPLY_CLIENT = 10900,  
	GS_TRACE_TXN_SEND_LOG,				
	GS_TRACE_TXN_SEND_ACK,				
	GS_TRACE_TXN_RECEIVE_LOG,			
	GS_TRACE_TXN_RECEIVE_ACK,			
	GS_TRACE_TXN_WAIT_FOR_TRANSACTION_END,
	GS_TRACE_TXN_REQUEST_IGNORED,
	GS_TRACE_TXN_INVALID_PARTITION_STATUS,
	GS_TRACE_TXN_REPLICATION_TIMEOUT,
	GS_TRACE_TXN_TRANSACTION_TIMEOUT,
	GS_TRACE_TXN_SESSION_TIMEOUT,
	GS_TRACE_TXN_CHECK_TIMEOUT,
	GS_TRACE_TXN_CLUSTER_VERSION_UNMATCHED,
	GS_TRACE_TXN_AUTHENTICATION_TIMEOUT,  
	GS_TRACE_TXN_KEEPALIVE_TIMEOUT, 

	GS_TRACE_SYNC_HANDLER = 20900,
	GS_TRACE_SYNC_HANDLER_DETAIL,
	GS_TRACE_SYNC_OPERATION,
	GS_TRACE_SYNC_NORMAL,
	GS_TRACE_SYNC_EVENT_SEND,
	GS_TRACE_SYNC_TRACE_STATS,
	GS_TRACE_SYNC_SIMULATE_FAILURE,

	GS_TRACE_CP_CONTROLLER_ILLEAGAL_STATE = 30900,
	GS_TRACE_CP_BACKUP_FAILED,
	GS_TRACE_CP_STATUS,
	GS_TRACE_CP_CHECKPOINT_CANCELLED,
	GS_TRACE_CP_PARAMETER_INFO,
	GS_TRACE_CP_FAILURE_SIMULATOR,
	GS_TRACE_CP_FLUSH_LOG,
	GS_TRACE_CP_LONGTERM_SYNC_INFO,  
	GS_TRACE_CP_LONGTERM_SYNC_FAILED,  
	GS_TRACE_CP_LONGTERM_SYNC_LOG_WRITE_FAILED,  
	GS_TRACE_CP_PREPARE_LONG_ARCHIVE_FAILED,

	GS_TRACE_CS_CLUSTER_STATUS = 40900,
	GS_TRACE_CS_UPDATE_START_LSN,
	GS_TRACE_CS_HANDLER,
	GS_TRACE_CS_HANDLER_DETAIL,
	GS_TRACE_CS_OPERATION,
	GS_TRACE_CS_NORMAL,
	GS_TRACE_CS_NORMAL_OPERATION,
	GS_TRACE_CS_EVENT_SEND,
#ifdef GD_ENABLE_UNICAST_NOTIFICATION
	GS_TRACE_CS_TRACE_INTERNAL,
#endif
	GS_TRACE_CS_TRACE_STATS,
	GS_TRACE_CS_TRACE_DUMP,

	GS_TRACE_SC_EVENT_LOG_STARTED = 50900,
	GS_TRACE_SC_UNEXPECTED_SHUTDOWN_DETECTED,
	GS_TRACE_SC_SERVICE_STARTED,
	GS_TRACE_SC_WEB_API_CALLED,
	GS_TRACE_SC_WEB_API_FAILED,
	GS_TRACE_SC_BAD_REQUEST,
	GS_TRACE_SC_BAD_STATUS,
	GS_TRACE_SC_CONFIG_UPDATED,
	GS_TRACE_SC_EVENT_LOG_UPDATED,
	GS_TRACE_SC_ARCHIVE_LOG_MODE_ENABLED,
	GS_TRACE_SC_ARCHIVE_LOG_START,
	GS_TRACE_SC_ARCHIVE_LOG_END,
	GS_TRACE_SC_TRACE_STATS,
	GS_TRACE_SC_FORCE_SHUTDOWN,

	GS_TRACE_DS_DS_CREATE_CONTAINER = 60900,
	GS_TRACE_DS_DS_UPDATE_CONTAINER,
	GS_TRACE_DS_DS_DROP_CONTAINER,
	GS_TRACE_DS_DS_DROP_PARTITION,
	GS_TRACE_DS_DS_CONTAINER_ID_TABLE_STATUS,
	GS_TRACE_DS_DS_LATCH_STATUS,
	GS_TRACE_DS_CON_DATA_AFFINITY_DEFINED,
	GS_TRACE_DS_CON_CREATE_INDEX,
	GS_TRACE_DS_CON_DROP_INDEX,
	GS_TRACE_DS_CON_CREATE_TRIGGER,
	GS_TRACE_DS_CON_UPDATE_TRIGGER,
	GS_TRACE_DS_TIM_COMPRESSION_INVALID_WARNING,
	GS_TRACE_DS_HASH_CHANGE_STATUS,
	GS_TRACE_DS_DS_CHANGE_STATUS,
	GS_TRACE_CHM_INTERNAL_INFO = 68900,
	GS_TRACE_CHM_FORCE_UNFIX,
	GS_TRACE_CHM_INVALID_PARAMETER,
	GS_TRACE_CHM_CONFIG,
	GS_TRACE_CHM_COMPRESSION_FAILED,
	GS_TRACE_CHM_INVALID_COMPRESSION,
	GS_TRACE_CHM_CP_FILE_FLUSH_SIZE,
	GS_TRACE_CHM_CHUNK_HASH_TABLE_SIZE,

	GS_TRACE_VC_PLUGIN_INFO = 65900,
	GS_TRACE_VC_PLUGIN_CREATE_INDEX,
	GS_TRACE_VC_PLUGIN_OPEN,

	GS_TRACE_LM_OPEN_SKIP_PARTITIONGROUP = 80900,
	GS_TRACE_LM_UNSUPPORTED_LOGTYPE,
	GS_TRACE_LM_UNKNOWN_LOGTYPE,
	GS_TRACE_LM_PUT_LOG_START,
	GS_TRACE_LM_PUT_LOG_INFO,
	GS_TRACE_LM_WRITE_DUPLICATE_LOG_FAILED,
	GS_TRACE_LM_FLUSH_DUPLICATE_LOG_FAILED,
	GS_TRACE_LM_CREATE_LOG_FILE_FAILED,
	GS_TRACE_LM_SCAN_LOG_INFO,
	GS_TRACE_LM_CLEANUP_LOG_FILES,
	GS_TRACE_LM_INCOMPLETE_TAIL_BLOCK,
	GS_TRACE_LM_FIND_LOG_INFO,
	GS_TRACE_LM_PREPARE_CHECKPOINT_FAILED,
	GS_TRACE_LM_POST_CHECKPOINT_FAILED,
	GS_TRACE_LM_FLUSH_SYNC_TEMP_LOG_FAILED,
	GS_TRACE_LM_PUT_SYNC_TEMP_LOG_FAILED,
	GS_TRACE_LM_CHUNK_META_LOG_SIZE,
	GS_TRACE_LM_LOG_VERSION,
	GS_TRACE_LM_FADVISE_LOG_FILE_FAILED,
	GS_TRACE_LM_FADVISE_LOG_FILE_INFO,

	GS_TRACE_EE_TIME_DIFF_ERROR = 130900,
	GS_TRACE_EE_WAIT_COMPLETION,
	GS_TRACE_EE_UNKNOWN_EVENT,
	GS_TRACE_EE_UNEXPECTED_SHUTDOWN,
	GS_TRACE_EE_HOOK_STARTED,
	GS_TRACE_EE_HOOK_CANCELLED,
	GS_TRACE_EE_HOOK_COMPLETED,	
	GS_TRACE_EE_SIMULATE_FAILURE,  

	GS_TRACE_RM_RECOVERY_INFO = 160900,
	GS_TRACE_RM_COMPLETE_UNDO,
	GS_TRACE_RM_APPLY_LOG_FAILED,
	GS_TRACE_RM_REDO_LOG_STATUS,
	GS_TRACE_RM_BACKUP_INFO_FILE_DIGEST,

	GS_ERROR_TRIG_SEND = 170900,
	GS_ERROR_TRIG_CONNECTION_POOL
};

#endif
